#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QToolBar>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
//    //创建菜单栏
//    QMenuBar * bar = this->menuBar();
//    this->setMenuBar(bar);

    //创建工具栏
    QToolBar * tool1 = new QToolBar();
    QToolBar * tool2 = new QToolBar();

    this->addToolBar(tool1);
    this->addToolBar(tool2);

    QAction * action1 = new QAction("功能1");
    QAction * action2 = new QAction("功能2");
    QAction * action3 = new QAction("功能3");
    QAction * action4 = new QAction("功能4");
    tool1->addAction(action1);
    tool1->addAction(action2);
    tool2->addAction(action3);
    tool2->addAction(action4);
    //控制工具栏的位置
    tool1->setAllowedAreas(Qt::RightToolBarArea|Qt::TopToolBarArea);
//    tool1->setFloatable(false);
    tool1->setMovable(false);


}

MainWindow::~MainWindow()
{
    delete ui;
}

